<template>
    <!-- 编辑发薪信息 -->
    <div id="paurollCompile">
        <!--btnArr：控制头部的文本以及数量 -->
        <operationPayrollTitle title="编辑发薪信息" :btnArr="btnArr" :fn="preserveFn" myIndex=0></operationPayrollTitle>
        <!-- starCss：控制*号的显示，myDisabled：控制表单是否禁用 --> 
        <operationPayrollForm :myDisabled="false" :starCss="{star:true}" :payrollData="cimpileData"></operationPayrollForm>
    </div>
</template>

<script>
// 头部
import operationPayrollTitle from './operationPayrollTitle'
// 表单
import operationPayrollForm from './operationPayrollForm'
// 请求数据
import {reqAccountInfo} from '../../request/payroll'
export default {
    components:{
        operationPayrollTitle,
        operationPayrollForm
    },
    data() {
        return {
            btnArr:["保存"],   //控制头部的文本以及数量
            cimpileData:[]
        }
    },
    mounted() {
        // 请求数据列表
        reqAccountInfo().then(res=>{
            this.cimpileData = res[this.$store.state.payrollIndex]
            console.log(res[this.$store.state.payrollIndex]);
        })
    },
    methods: {
        // 保存数据
        preserveFn(){
            this.$store.commit("preserve")
            this.$router.push("/home/payroll")
        },
    },
}
</script>

<style lang="less">
    #paurollCompile{
        background-color: #ffffff;
    }
</style>